{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Adapterパターン(継承)\n",
    "\n",
    "* どんな時使うのか\n",
    "    * 既に存在するクラスを再利用するとき\n",
    "        * そのクラスが十分テストされ、バグが少なく実績があるので部品として再利用したい\n",
    "    * 既存のクラスに一皮かぶせるクラスを作る\n",
    "        * 必要とするメソッド群を素早く作ることができる\n",
    "        * もしバグが出ても再利用しているクラスに実績があるのであれば、Adapterのクラスを重点的に調べればよい\n",
    "            * プログラムのチェックが楽になる\n",
    "    * 既存のクラスを新しいインタフェース(API)に適合させるとき\n",
    "        * <font color=\"red\">既存のクラスのソースをいじって修正することは避けるべき</font>\n",
    "            * テストの完了している既存のクラスを再度テストしなければならなくなるため\n",
    "        * Adapterパターンは既存のクラスにまったく手を加えず目的のインタフェースに合わせる事ができる\n",
    "            * 既存のクラスの仕様だけ分かれば新しいクラスを作ることができる\n",
    "            * 既存のクラスのソースプログラムは必ずしも必要ではない"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Bannerクラス"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=Banner\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} {\n",
    "    private String string;\n",
    "    public ${name}(String string) {\n",
    "        this.string = string;\n",
    "    }\n",
    "    \n",
    "    public void showWithParen() {\n",
    "        System.out.println(\"(\" + string + \")\");\n",
    "    }\n",
    "\n",
    "    public void showWithAster() {\n",
    "        System.out.println(\"*\" + string + \"*\");\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Printインタフェース"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=Print\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public interface ${name} {\n",
    "    public abstract void printWeak();\n",
    "    public abstract void printStrong();\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## PrintBannerクラス"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=PrintBanner\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} extends Banner implements Print {\n",
    "    public ${name}(String string) {\n",
    "        super(string);\n",
    "    }\n",
    "    \n",
    "    public void printWeak() {\n",
    "        showWithParen();\n",
    "    }\n",
    "    \n",
    "    public void printStrong() {\n",
    "        showWithAster();\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Mainクラス"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(Hello)\n",
      "*Hello*\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=Main\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} {\n",
    "    public static void main(String[] args) {\n",
    "        Print p = new PrintBanner(\"Hello\");\n",
    "        p.printWeak();\n",
    "        p.printStrong();\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java\n",
    "\n",
    "### 実行\n",
    "#java -classpath ${classpath} ${name}\n",
    "java ${name}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "current_dir=`pwd`\n",
    "isbn=\"ISBN4-7973-2703-0\"\n",
    "fig=\"Fig.2-2\"\n",
    "\n",
    "### サンプルコードの作成\n",
    "cat <<- EOS > ${current_dir}/plantuml/${isbn}_${fig}.pu\n",
    "@startuml\n",
    "skinparam classAttributeIconSize 0\n",
    "\n",
    "class Main {\n",
    "}\n",
    "\n",
    "interface Print {\n",
    "    {abstract} +void printWeak()\n",
    "    {abstract} +void printStrong()\n",
    "}\n",
    "\n",
    "class PrintBanner {\n",
    "    +void printWeak()\n",
    "    +void printStrong()    \n",
    "}\n",
    "\n",
    "class Banner {\n",
    "    +void showWithParen()\n",
    "    +void showWithAster()\n",
    "}\n",
    "\n",
    "Main --> Print : Uses >\n",
    "Print <|.. PrintBanner\n",
    "Banner <|-- PrintBanner\n",
    "\n",
    "@enduml\n",
    "EOS\n",
    "\n",
    "### サンプルコードからUMLの図を作成\n",
    "java -jar plantuml.jar -o ${current_dir}/img -tpng ${current_dir}/plantuml/${isbn}_${fig}.pu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## 継承を使ったAdapterパターン\n",
    "\n",
    "<img src=\"img/ISBN4-7973-2703-0_Fig.2-2.png\" alt=\"Adapterパターンのクラス図1\" title=\"Adapterパターンのクラス図1\" align=\"left\" />  \n",
    "<br clear=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "* Bannerクラス\n",
    "    * あらかじめ提供されているクラス\n",
    "* Printインタフェース\n",
    "    * 必要とされているインタフェース\n",
    "    * Mainはこのインタフェースを通してBannerクラスを使う\n",
    "* PrintBannerクラス\n",
    "    * アダプターの役割を果たす\n",
    "    * <font color=\"red\">Bannerクラスを拡張(extends)</font>して,showWithParenメソッドとshowWithAsterメソッドを<font color=\"red\">継承する</font>\n",
    "    * <font color=\"red\">Printインタフェースを実装</font>してprintWeakメソッドとprintStrongメソッドを<font color=\"red\">実装</font>している\n",
    "* Mainクラス\n",
    "    * アダプター役のPrintBannerクラスを使ってHelloという文字を弱く(カッコつき)、強く(*ではさんで)表示している\n",
    "    * <font color=\"red\">PrintBannerのインスタンスをPrintインタフェースの変数に代入している</font>\n",
    "        * MainクラスはあくまでPrintというインタフェースを使ってプログラミングしている\n",
    "        * Bannerクラスのメソッドは、Mainクラスのソースコード上からはすっかり隠されている\n",
    "        * PrintBannerクラスがどのように実装されているかをMainクラスは知らない\n",
    "            * <font color=\"red\">Mainクラスを全く変更せずにPrintBannerクラスの実装を変えられる</font>ということでもある"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "current_dir=`pwd`\n",
    "isbn=\"ISBN4-7973-2703-0\"\n",
    "fig=\"Fig.2-4\"\n",
    "\n",
    "### コードの作成\n",
    "cat <<- EOS > ${current_dir}/plantuml/${isbn}_${fig}.pu\n",
    "@startuml\n",
    "skinparam classAttributeIconSize 0\n",
    "\n",
    "class Main {\n",
    "}\n",
    "\n",
    "abstract class Print {\n",
    "    {abstract} +void printWeak()\n",
    "    {abstract} +void printStrong()\n",
    "}\n",
    "\n",
    "class PrintBanner {\n",
    "    -banner Banner\n",
    "    +void printWeak()\n",
    "    +void printStrong()    \n",
    "}\n",
    "\n",
    "class Banner {\n",
    "    +void showWithParen()\n",
    "    +void showWithAster()\n",
    "}\n",
    "\n",
    "Main --> Print : Uses >\n",
    "Print <|-- PrintBanner\n",
    "Banner <--o PrintBanner\n",
    "\n",
    "@enduml\n",
    "EOS\n",
    "\n",
    "### コードからUMLの図を作成\n",
    "java -jar plantuml.jar -o ${current_dir}/img -tpng ${current_dir}/plantuml/${isbn}_${fig}.pu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Adapterパターン(委譲)\n",
    "\n",
    "* Bannerクラス、Mainクラスは先ほどと同じ\n",
    "\n",
    "<img src=\"img/ISBN4-7973-2703-0_Fig.2-4.png\" alt=\"Adapterパターンのクラス図2\" title=\"Adapterパターンのクラス図2\" align=\"left\" />  \n",
    "<br clear=\"left\">\n",
    "\n",
    "* 継承と委譲の違い\n",
    "    * 継承\n",
    "        * クラスによるAdapterパターン\n",
    "    * 委譲\n",
    "        * あるメソッドの実際の処理を他のインスタンスのメソッドにまかせること\n",
    "        * インスタンスによりAdapterパターン\n",
    "    * Printクラス\n",
    "        * 先ほどとは違い<font color=\"red\">インタフェースでは無くクラス</font>\n",
    "            * Bannerクラスを利用してPrintクラスと同じメソッドを持つクラスを実現する\n",
    "    * PrintBannerクラス\n",
    "        * Javaは<font color=\"red\">2つのクラスを同時に継承することはできない</font>\n",
    "            * PrintBannerクラスをPrintとBannerの両方のサブクラスとして定義することはできない\n",
    "        * bannerフィールドでBannerクラスのインスタンスを保持する\n",
    "            * インスタンスはPrintBannerクラスのコンストラクタで生成する\n",
    "        * printWeak, printStrongメソッド\n",
    "            * bannerフィールドを介してshowWithParen, showWithAsterメソッドを呼び出す\n",
    "                * <u>PrintBannerクラスのprintWeakメソッドは、自分で処理をするのではなく別のインスタンス(Bannerクラスのインスタンス)のshowWithParenメソッドに処理を任せている</u>\n",
    "        * 継承と委譲の違い\n",
    "            * 継承(さっきの例)\n",
    "                * 自分のスーパークラスから継承したshowWithParen, showWithAsterメソッドを呼んでいた\n",
    "            * 委譲(今回の例)\n",
    "                * フィールド経由で呼び出している\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Printクラス"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=Print\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public abstract class ${name} {\n",
    "    public abstract void printWeak();\n",
    "    public abstract void printStrong();\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## PrintBannerクラス"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "### 変数の設定\n",
    "name=PrintBanner\n",
    "\n",
    "### ソースの編集\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} extends Print {\n",
    "    private Banner banner;\n",
    "    public ${name}(String string) {\n",
    "        this.banner = new Banner(string);\n",
    "    }\n",
    "    \n",
    "    public void printWeak() {\n",
    "        banner.showWithParen();\n",
    "    }\n",
    "    \n",
    "    public void printStrong() {\n",
    "        banner.showWithAster();\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "current_dir=`pwd`\n",
    "isbn=\"ISBN4-7973-2703-0\"\n",
    "fig=\"Fig.2-5\"\n",
    "\n",
    "### サンプルコードの作成\n",
    "cat <<- EOS > ${current_dir}/plantuml/${isbn}_${fig}.pu\n",
    "@startuml\n",
    "skinparam classAttributeIconSize 0\n",
    "\n",
    "class Client {\n",
    "}\n",
    "\n",
    "interface Target {\n",
    "    {abstract} +targetMethod1()\n",
    "    {abstract} +targetMethod2()\n",
    "}\n",
    "\n",
    "class Adapter {\n",
    "    +targetMethod1()\n",
    "    +targetMethod2()    \n",
    "}\n",
    "\n",
    "class Adaptee {\n",
    "    +MethodA()\n",
    "    +MethodB()\n",
    "    +MethodC()\n",
    "}\n",
    "\n",
    "Client --> Target : Uses >\n",
    "Target <|.. Adapter : implements >\n",
    "Adaptee <|-- Adapter : extends >\n",
    "\n",
    "@enduml\n",
    "EOS\n",
    "\n",
    "### サンプルコードからUMLの図を作成\n",
    "java -jar plantuml.jar -o ${current_dir}/img -tpng ${current_dir}/plantuml/${isbn}_${fig}.pu"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "current_dir=`pwd`\n",
    "isbn=\"ISBN4-7973-2703-0\"\n",
    "fig=\"Fig.2-6\"\n",
    "\n",
    "### コードの作成\n",
    "cat <<- EOS > ${current_dir}/plantuml/${isbn}_${fig}.pu\n",
    "@startuml\n",
    "skinparam classAttributeIconSize 0\n",
    "\n",
    "class Client {\n",
    "}\n",
    "\n",
    "abstract class Target {\n",
    "    {abstract} +targetMethod1()\n",
    "    {abstract} +targetMethod2()\n",
    "}\n",
    "\n",
    "class Adapter {\n",
    "    -adaptee\n",
    "    +targetMethod1()\n",
    "    +targetMethod2()  \n",
    "}\n",
    "\n",
    "class Adaptee {\n",
    "    +MethodA()\n",
    "    +MethodB()\n",
    "    +MethodC()\n",
    "}\n",
    "\n",
    "Client --> Target : Uses >\n",
    "Target <|-- Adapter : extends >\n",
    "Adaptee <--o Adapter : has >\n",
    "\n",
    "@enduml\n",
    "EOS\n",
    "\n",
    "### コードからUMLの図を作成\n",
    "java -jar plantuml.jar -o ${current_dir}/img -tpng ${current_dir}/plantuml/${isbn}_${fig}.pu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Adapterパターンのクラス図(継承を使う)\n",
    "\n",
    "<img src=\"img/ISBN4-7973-2703-0_Fig.2-5.png\" alt=\"Adapterパターンのクラス図(継承)\" title=\"Adapterパターンのクラス図(継承)\" align=\"left\" />  \n",
    "<br clear=\"left\">\n",
    "\n",
    "Adapterパターンのクラス図(委譲を使う)\n",
    "\n",
    "<img src=\"img/ISBN4-7973-2703-0_Fig.2-6.png\" alt=\"Adapterパターンのクラス図(委譲)\" title=\"Adapterパターンのクラス図(委譲)\" align=\"left\" />  \n",
    "<br clear=\"left\">\n",
    "\n",
    "## Adapterパターンの登場人物\n",
    "\n",
    "* Target(対象)の役\n",
    "    * 今必要となっているメソッドを定めている役\n",
    "        * サンプルプログラム\n",
    "            * Printインタフェース(継承の時)\n",
    "            * Print抽象クラス(委譲の場合)\n",
    "* Client(依頼者)の役\n",
    "    * Targetのメソッドを使って仕事をする役\n",
    "        * サンプルプログラム\n",
    "            * Mainクラス\n",
    "* Adaptee(適合される側)の役\n",
    "    * Adapt-er(適合する側)ではなく<font color=\"red\">Adapt-ee(適合される側)</font>\n",
    "        * 既に用意されているメソッドをもっている\n",
    "        * サンプルプログラム\n",
    "            * Bannerクラス\n",
    "    * Adaptee役のメソッドがTarget役のメソッドと一致している場合は次のAdapter役は不要\n",
    "* Adapterの役\n",
    "    * Adapterパターンの主人公\n",
    "    * Adaptee役のメソッドを使って何とかTarget役を満たす\n",
    "        * サンプルプログラム\n",
    "            * PrintBannerクラス"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## 以下確認用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(Hello)\n",
      "*Hello*\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "\n",
    "### Adapterパターン(継承)\n",
    "\n",
    "# ================================================ #\n",
    "name=Banner\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public class ${name} {\n",
    "    private String string;\n",
    "    public ${name}(String string) {\n",
    "        this.string = string;\n",
    "    }\n",
    "    \n",
    "    public void showWithParen() {\n",
    "        System.out.println(\"(\" + string + \")\");\n",
    "    }\n",
    "\n",
    "    public void showWithAster() {\n",
    "        System.out.println(\"*\" + string + \"*\");\n",
    "    }\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=Print\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public interface ${name} {\n",
    "    public abstract void printWeak();\n",
    "    public abstract void printStrong();\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=PrintBanner\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public class ${name} extends Banner implements Print {\n",
    "    public ${name}(String string) {\n",
    "        super(string);\n",
    "    }\n",
    "    \n",
    "    public void printWeak() {\n",
    "        showWithParen();\n",
    "    }\n",
    "    \n",
    "    public void printStrong() {\n",
    "        showWithAster();\n",
    "    }\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=Main\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} {\n",
    "    public static void main(String[] args) {\n",
    "        Print p = new PrintBanner(\"Hello\");\n",
    "        p.printWeak();\n",
    "        p.printStrong();\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java\n",
    "\n",
    "### 実行\n",
    "#java -classpath ${classpath} ${name}\n",
    "java ${name}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(Hello)\n",
      "*Hello*\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "\n",
    "### Adapterパターン(委譲)\n",
    "\n",
    "# ================================================ #\n",
    "name=Banner\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public class ${name} {\n",
    "    private String string;\n",
    "    public ${name}(String string) {\n",
    "        this.string = string;\n",
    "    }\n",
    "    \n",
    "    public void showWithParen() {\n",
    "        System.out.println(\"(\" + string + \")\");\n",
    "    }\n",
    "\n",
    "    public void showWithAster() {\n",
    "        System.out.println(\"*\" + string + \"*\");\n",
    "    }\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=Print\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public abstract class ${name} {\n",
    "    public abstract void printWeak();\n",
    "    public abstract void printStrong();\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=PrintBanner\n",
    "cat <<- EOS > ${name}.java\n",
    "\n",
    "public class ${name} extends Print {\n",
    "    private Banner banner;\n",
    "    public ${name}(String string) {\n",
    "        this.banner = new Banner(string);\n",
    "    }\n",
    "    \n",
    "    public void printWeak() {\n",
    "        banner.showWithParen();\n",
    "    }\n",
    "    \n",
    "    public void printStrong() {\n",
    "        banner.showWithAster();\n",
    "    }\n",
    "}\n",
    "\n",
    "EOS\n",
    "\n",
    "# ================================================ #\n",
    "name=Main\n",
    "cat <<- EOS > ${name}.java\n",
    "public class ${name} {\n",
    "    public static void main(String[] args) {\n",
    "        Print p = new PrintBanner(\"Hello\");\n",
    "        p.printWeak();\n",
    "        p.printStrong();\n",
    "    }\n",
    "}\n",
    "EOS\n",
    "\n",
    "### コンパイル\n",
    "javac ${name}.java\n",
    "#javac -encoding UTF-8 ${name}.java\n",
    "\n",
    "### 実行\n",
    "#java -classpath ${classpath} ${name}\n",
    "java ${name}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
